package 代码随想录.字符串.反转字符串;

/**lc:344反转字符串
 * link：https://leetcode-cn.com/problems/reverse-string/
 * @author ChenweiLin
 * @create 2021-12-22 10:24
 */
public class ReverseString {
    public static void main(String[] args) {

    }

    class Solution {
        public void reverseString(char[] s) {
            //双指针镜像调换
            int left = 0;
            int right = s.length-1;
            //辅助指针
            char temp = ' ';
            while(left < right){
                temp = s[left];
                s[left] = s[right];
                s[right] = temp;
                left++;
                right--;
            }
        }
    }
}
